package com.wzy.facetextview.Utils;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.util.Log;
import android.widget.Toast;


public class URLClickListener implements TextLinkClickSpan.ClickLinkListener {
    private static final String TAG = "wang.URLClickListener";
    private Context mContext;
    private String mUrl;

    public URLClickListener(Context context, String url) {
        super();
        this.mContext = context;
        this.mUrl = url;
    }

    @Override
    public void clickLinkCallBack(int id) {
        Log.d(TAG, "clickLinkCallBack");
        Toast.makeText(mContext, "URL clicked!!!!!!!!!!!!!", Toast.LENGTH_LONG).show();
        if (!mUrl.contains("http://") && !mUrl.contains("https://")) {
            mUrl = "http://" + mUrl;
        }
        Uri uri = Uri.parse(mUrl);
        Intent intent = new Intent(Intent.ACTION_VIEW, uri);
        mContext.startActivity(intent);
    }
}
